﻿ @{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">

    <title>奖品详情</title>
    <script src="~/Content/Script/jquery.min.js"></script>
    <script src="~/Scripts/base64.js"></script>
    <style>
           * {
            padding: 0;
            margin: 0;
            cursor:pointer;
        }
       
        .award-details,body {
            width: 100%;
            height: 100%;
            background: #f2f2f2;
            position:absolute;
        }
          #LoadingBar {
            position:absolute;
            background-color: rgba(0,0,0,.85);
            width: 100%;
            height: 100%;
            display:flex;
            align-items:center;
            justify-content:center;
            z-index:999;
        }
             .OneKeyAttention {
            width: 100%;
            height: 100%;
            position: absolute;
            background-color: rgba(0,0,0,.85);
            z-index: 555;
            display: none;
        }


            .OneKeyAttention .Attention-con {
                width: 80%;
                left: 10%;
                top: 10%;
                height: 65%;
                position: absolute;
                background-color: white;
                z-index: 556;
                border-radius: 4px;
                display: flex;
                align-items: center;
                justify-content: space-around;
                flex-direction: column;
            }

                .OneKeyAttention .Attention-con > img:nth-child(1) {
                    width: 60%;
                    margin: 0 auto;
                    display: block;
                }

                .OneKeyAttention .Attention-con > img:nth-child(2) {
                    width: 36%;
                    margin: 0 auto;
                    display: block;
                }
                  .closeBgCon {
            position: absolute;
            width: 100%;
            height: 50px;
            bottom: 3%;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
        }

      .closeBgCon img {
            width: 50px;
            height: 100%;
            cursor: pointer;
        }

            .award-details .award-head {
                background: #CB0101;
                text-align: center;
                color: white;
                padding: 10px 0;
                color:#FDBE9B;
            }

                .award-details .award-head p:nth-child(1) {
                    text-align: left;
                }

            .award-details .award-body {
                background: white;
                text-align: center;
                padding: 10px 0;
                color:gray;
            }

            .award-details .award-details-list {
                display: none;
                align-items: center;
                padding: 10px;
                border-bottom: solid 1px #E0E0E0;
                background: white;
            }

                .award-details .award-details-list span:nth-child(1) {
                    margin-left: 5px;
                }

                .award-details .award-details-list span:nth-child(2) {
                    margin-right: 5px;
                    margin-left: 5px; 
                }

                .award-details .award-details-list span:nth-child(3) {
                    margin-right: 5px;
                }
        a {
            text-decoration: none;
        }
    </style>
</head>
<body >
    <div id="LoadingBar">
        <img src="~/Content/Images/redpack/loading.gif" />
    </div>
    <div id="content">

    </div>

</body>
</html>

<script>
    //活动详情 关注我们
    function AwAttention() {
        
        $('.OneKeyAttention').css('display', 'block')
    }

    function OneKeyAttention(ele, event) {
        $(ele).css('display', 'none');
        event.stopPropagation();
    }
    function Attention(event) {
        event.stopPropagation();
    }
    var tid = "@ViewBag.Tid";//模板Id
    $.ajax({
        url: "PrizeDetailsShowHtml",
        data: { id:tid},
        type:"post",
        success: function (res) {
            $("#content").html(decode(res));
            $('#content .pageTitle').remove();
            getAwardInfo();
        }
    });



    //关闭微信页面 
   
    function closePage() {
        WeixinJSBridge.call('closeWindow');
    }

        function DateFormat(val) {
            var date = new Date(parseInt(val.replace("/Date(", "").replace(")/", ""), 10));
            //月份为0-11，所以+1，月份小于10时补个0
            var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
            var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
            var currentHour = date.getHours();
            var currentMin = date.getMinutes();
            var currentSecond = date.getSeconds();
            var dd = date.getFullYear() + "-" + month + "-" + currentDate + " " + " " + " " + " " + currentHour + ":" + currentMin + ":" + currentSecond;
            return dd;
        }
    //获取地址参数
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }
       
        //获取我的中奖记录数据
        function getAwardInfo() {
            $.ajax({
                url: "/app/Template/GetTheWinning",
                data: { tId: GetQueryString('tId') },
                type: "get",
                success: function (res) {
                    var word = '';
                    var wordType = '';
                    if (res.type==1)
                    {
                        word = '微信红包' + res.Denomination.toFixed(2) + '元';
                        wordType = '领取了红包';

                    }
                   else if (res.type == 2) {
                       word = '优惠券' + res.Denomination.toFixed(2) + '元';
                       wordType = '领取了优惠券';
                   }
                   else if (res.type == 3) {
                       word = +res.Denomination.toFixed(2) + '元流量券';
                       wordType = '领取了流量券';
                   }
                   
                    $('#EnterpriseName').text(res.EnterpriseName || '广州微信事业部').next().text(word).next().text('您已于' + DateFormat(res.Time) + wordType);
                    $('#handleTips').text(res.AwCongrats).prev().text('活动码:'+res.JiaMiCode);

                    function initPage() {
                        var objLoading = document.getElementById("LoadingBar");
                        if (objLoading != null) {
                            objLoading.style.display = "none";
                        }
                    }
                    initPage();
                }
            });
        }

     
</script>
